-- 2012-05-17 EM .
alter procedure sp_get_user_by_name
	@Name varchar(50),
	@Phone varchar(21) output,
	@uid int output
as
begin
	set nocount on;
	
	set @uid = null;

	
	select @uid = uid, @Phone=phone from dbdata.dbo.users as u
	join dbdata.dbo.phones as p on p.uid=u.id 
	where name = @name and p.dt_removed is null 
	--and p.enabled=1 	and p.as_default=1 ;
end;
go

grant execute on sp_get_user_by_name to Executer;